<template>

	<!-- Authors Table Card -->
	<a-card :bordered="false" class="header-solid h-full" :bodyStyle="{padding: 0,}"  >
		<template #title>
			<a-row type="flex" align="middle" >
				<a-col :span="24" :md="12">
					<h5 class="font-semibold m-0">认证审核列表</h5>
				</a-col>

			</a-row>

		</template>
		<a-table :columns="columns" :data-source="data" :pagination="true" >

			<template slot="user" slot-scope="user">
				<div class="table-avatar-info">
					<a-avatar shape="square" :src="user.avatar" />
					<div class="avatar-info">
						<h6>{{ user.name }}</h6>
						<p>{{ user.email }}</p>
					</div>
				</div>
			</template>

<!--			<template slot="func" slot-scope="func">-->
<!--				<div class="author-info">-->
<!--					<h6 class="m-0">{{ func.job }}</h6>-->
<!--					<p class="m-0 font-regular text-muted">{{ func.department }}</p>-->
<!--				</div>-->
<!--			</template>-->
      <template slot="reportInfo" slot-scope="reportInfo" >
        <p @click="openPage(reportInfo.link)" style="margin: 0; cursor: pointer;">{{reportInfo.data}}</p>
      </template>



			<template slot="button" slot-scope="data">
				<a-button type="primary" :data-id="data.key" class="btn-edit" shape="round" style="color: white; margin: 2px; height: 30px;" @click="updateStatus(data.key,'已审核')">
					同意
				</a-button>
        <a-button type="danger" :data-id="data.key" class="btn-edit" shape="round" style="color: white; margin: 2px; height: 30px" @click="updateStatus(data.key,'已拒绝')">
          拒绝
        </a-button>
			</template>

		</a-table>

<!--&lt;!&ndash;分页功能实现&ndash;&gt;-->
<!--    <el-pagination-->
<!--        background-->
<!--        layout="prev, pager, next"-->
<!--        :total="1000" style="margin-top: 10px; margin-bottom: 10px; text-align: center">-->
<!--    </el-pagination>-->
	</a-card>



	<!-- / Authors Table Card -->

</template>

<style>
.header-solid{
  animation-duration:1s
}
</style>
<script>

	export default ({
		props: {
			data: {
				type: Array,
				default: () => [],

			},

			columns: {
				type: Array,
				default: () => [],
			},
		},

    methods:{
      openPage(path) {
        this.$router.push({
          path: path
        });

      },
		  updateStatus(caseId,status){

		    this.updateCase.caseId = caseId
        console.log(this.updateCase.caseId)
        this.updateCase.status = status
        this.$axios({
          headers: {
            "Content-Type": "application/json;charset=UTF-8",
            "Authorization": sessionStorage.getItem("systemToken")
          },
          url: "/api/case/updateStatus", //后端请求的路径
          method: "POST",
          data: this.updateCase

        }).then((response) => {
          if (response.data.status === 0 ){
            location.reload()

          }


        });
      }
    },
		data() {
			return {
				// Active button for the "Authors" table's card header radio button group.
				authorsHeaderBtns: 'all',
        updateCase:{
          caseId: 0,
          status:''
        },

			}
		},
	})

</script>